<template>
    <div style="width: 176px">
        <div class="header-title">
            <div class="panel-big-title" style="margin-bottom: 0">辐</div>
        </div>
        <BasePanel width="100%" height="260px">
            <template #title>
                <div @click.stop class="new-title">
                    <ElDatePicker
                        v-model="selectTime"
                        class="reset-el-date-picker"
                        type="month"
                        :clearable="false"
                        format="YYYY年MM月"
                        :editable="false"
                    />
                    <ElIcon style="margin-right: 8px; margin-left: 4px; font-size: 12px"
                        ><ArrowDownBold
                    /></ElIcon>
                </div>
            </template>
            <template #default>
                <div class="panel-content">
                    <div class="bg-icon">
                        <img class="bg" :src="img" alt="" />
                    </div>
                    <div class="info-box">
                        <span class="title">总量</span>
                        <div class="value-box">
                            <span class="value">{{ panelData.v1 }}</span>
                            <span class="unit">{{ panelData.v1Unit }}</span>
                        </div>
                    </div>
                    <div class="label">本月巡检率</div>
                    <div class="value-box">
                        <span class="value">{{ panelData.v1 }}</span>
                        <span class="unit">{{ panelData.v1Unit }}</span>
                    </div>
                </div>
            </template>
        </BasePanel>
    </div>
</template>

<script setup lang="ts">
import { ArrowDownBold } from '@element-plus/icons-vue'
import BasePanel from '@/components/BasePanel/index.vue'
import { getFpiAssetsFile } from '@/utils/tools'
// import { useGlobalStore } from '@/store/global';
import dayjs from 'dayjs'

// 全局数据
// const globalStore = useGlobalStore()

// 选择的时间
const selectTime = ref(dayjs().toDate())

//
const img = getFpiAssetsFile('global/fushe-bg.png')

// 面板数据
const panelData = reactive({
    v1: '99.58',
    v1Unit: '%',
    v1Target: '88.7',
    v2: '100',
    v2Unit: '%',
    v2Target: '88.7',
})
</script>

<style lang="scss" scoped>
.header-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.new-title {
    display: flex;
    align-items: center;

    :deep(.reset-el-date-picker) {
        width: 110px;

        .el-input__prefix {
            display: none !important;
        }

        .el-input__suffix {
            display: none !important;
        }

        .el-input__wrapper {
            padding: 0 !important;
            text-align: right !important;
            background: none !important;
            border: none !important;
            box-shadow: none !important;
        }

        .el-input__inner {
            font-size: 20px !important;
            font-weight: bolder;
            text-align: right !important;
            color: #fff !important;
        }
    }
}

.panel-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;

    .bg-icon {
        width: 100%;
        height: 72px;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        position: relative;

        .bg {
            width: 120px;
            position: absolute;
            top: -6px;
            left: 50%;
            transform: translateX(-50%);
            user-select: none;
        }
    }

    .label {
        font-size: 20px;
        font-weight: 700;
        line-height: 20px;
        color: rgba(255, 255, 255, 1);
        height: 20px;
    }

    .value-box {
        display: flex;
        align-items: flex-end;
        gap: 4px;

        .value {
            font-size: 28px;
            font-weight: 400;
            line-height: 28px;
            color: rgba(1, 254, 133, 1);
            height: 28px;
            font-family: Oswald;
        }
        .unit {
            font-size: 16px;
            font-weight: 700;
            line-height: 16px;
            height: 16px;
            color: rgba(255, 255, 255, 1);
        }
    }

    .info-box {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 12px;

        .value-box {
            .value {
                font-size: 24px;
                height: 24px;
                line-height: 24px;
            }
        }
    }
}
</style>
